#ifndef pkm_abstractviewport_h
#define pkm_abstractviewport_h

#include <vector>
#include "RenderLayer.h"
#include "RenderObject.h"
#include "PosLoc2D.h"

#define MAX_OBJS_PER_LAYER 10000
namespace k2graphics 
{

class AbstractViewport
{
private:
	std::vector<RenderLayer*> layers;
	float viewportX;
	float viewportY;
	float viewportWidth;
	float viewportHeight;

	int viewportGroup;
	int viewportMask;

	// used to store the viewport's position and stuff
	float* viewportSettings;
	int numSettings;
	bool contentUpdated;
	bool isNetworkCloned;
public:
	AbstractViewport(int numLayers);
	void clearObjects();
	void pushObject(RenderObject* ro);
	void pushObjectNoQuestions(RenderObject* ro);
	void setPosition(float nx, float ny);
	void setDimensions(float nwidth, float nheight);

	void deleteAllLayerData();

	/*
	int writeToByteArray(unsigned char* dest, int maxBytes);
	int readFromByteArray(unsigned char* src, int numBytes);
	*/

	bool hasContentUpdated(){return contentUpdated;}
	void setContentUpdated(bool nstate){contentUpdated = nstate;}
	bool isANetworkClone(){return isNetworkCloned;}
	void setCloneState(bool nstate){isNetworkCloned = nstate;}

	void setGroup(int g);
	void setMask(int m);

	PosLoc2D getPosition();
	PosLoc2D getDimensions();

	RenderLayer* getLayer(int layer);

	void debugPrintEverything();
	//void genTestData();

	void writeSettings();
	float* getSettings();
	int getNumSettings();
};

}
#endif